from pathlib import Path


BASE_DIR = Path(__file__).resolve().parent.parent

SECRET_KEY = '0^)88FI7b&rwXaWGcNHZCxG+8dn=jWGf^Bia+b4sBd#aabjoi^fiuSU+u29r)!3*x'

DEBUG = True

ALLOWED_HOSTS = ['127.0.0.1']

SESSION_COOKIE_AGE = 80000

INSTALLED_APPS = [
    'simpleui',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'ckeditor',  # 富文本编辑
    'main',
    'home'  # 官网管理
]

SIMPLEUI_INDEX = '/'
SIMPLEUI_HOME_INFO = False
SIMPLEUI_ANALYSIS = False
SIMPLEUI_DEFAULT_ICON = False


MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.middleware.locale.LocaleMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'antcook.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [Path(BASE_DIR, 'templates')],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

WSGI_APPLICATION = 'antcook.wsgi.application'

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': Path(BASE_DIR, 'db.sqlite3'),
    },
}


AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
    },
]

AUTHENTICATION_BACKENDS = ('django.contrib.auth.backends.ModelBackend',)

LANGUAGE_CODE = 'zh-hans'

TIME_ZONE = 'Asia/Shanghai'

USE_I18N = True

USE_L10N = True

USE_TZ = False

DEFAULT_CHARSET = 'utf-8'

FILE_CHARSET = 'utf-8'

LANGUAGES = (
    # ('en', 'English'),
    ('zh-hans', '中文简体'),
    # ('zh-hant', '中文繁體'),
)

LOCALE_PATHS = (
    Path(BASE_DIR, 'locale'),
)

STATIC_URL = '/static/'
STATIC_ROOT = Path(BASE_DIR, 'static')
# STATICFILES_DIRS = [Path(BASE_DIR, 'static'), ]
STATICFILES_FINDERS = (
  'django.contrib.staticfiles.finders.FileSystemFinder',
  'django.contrib.staticfiles.finders.AppDirectoriesFinder',
)

# https://github.com/glasslion/django-qiniu-storage
QINIU_ACCESS_KEY = '******'
QINIU_SECRET_KEY = '******'
QINIU_BUCKET_NAME = '******'
QINIU_BUCKET_DOMAIN = '******'
QINIU_SECURE_URL = False

DEFAULT_FILE_STORAGE = 'qiniustorage.backends.QiniuStorage'

# Aliyun dysms_python
ACCESS_KEY_ID = "******"
ACCESS_KEY_SECRET = "******"

APP_COMPANY_NAME = '蚂蚁商厨'
APP_ORDER_KEY = "******"
APP_MOBILE = ['15068826001', '17506533179']

try:
    from .local_settings import *
except ImportError:
    pass
